<template>
  <view class="picker-item">
    <view class="label">{{ label }}</view>
    <input
      class="input"
      :value="modelValue"
      :type="type"
      :maxlength="maxlength"
      :placeholder="`请输入${label}`"
      @input="(e) => $emit('update:modelValue', e.target.value)"
    />
  </view>
</template>

<script>
export default {
  props: {
    label: {
      type: String,
      default: '',
    },
    modelValue: {
      type: String,
      default: '',
    },
    type: {
      type: String,
      default: 'text',
    },
    maxlength: {
      type: [Number, String],
      default: -1,
    },
  },
};
</script>

<style lang="less" scoped>
.picker-item {
  padding: 30rpx 34rpx;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid #eee;
  color: #666;
  font-size: 32rpx;
  .label {
    flex-shrink: 0;
  }
  .input {
    margin-left: 20rpx;
    flex: 1;
    height: 100%;
    text-align: right;
  }
}
</style>
